#!/bin/bash
set -e  # Exit immediately if a command exits with a non-zero status.

DIR=$1
PKG=$2
VERSION=$3
SRC_TAR=$4
SRPM=$PKG-$VERSION-1.tl3.src.rpm	# TODO: tl3后缀依赖server是TS3


cd "$DIR/$PKG/$PKG"
sha512sum --tag $SRC_TAR > sources
printf "\n" >>  sources
/root/package-build/ocs-tss-switcher/OCS/upload-tarball-stream.sh $PKG $SRC_TAR
rm $SRC_TAR
rm /usr/share/nginx/html/files/$SRPM
git add .
git commit -m "Upgrade to $VERSION"
git push